//
//  LoginResponse.swift
//  swiftBase
//
//  Created by 郭艳波 on 2018/3/7.
//  Copyright © 2018年 郭艳波. All rights reserved.
//

import Foundation
import ObjectMapper

class LoginResponse: NSObject, Mappable {
    var code: Int!
    var data: LoginDataResponse!
    
    required init?(map: Map) {
        if map.JSON["code"] == nil { return nil }
        if map.JSON["data"] == nil { return nil }
    }
    
    func mapping(map: Map) {
        code   <- map["code"]
        data   <- map["data"]
    }
}

class LoginDataResponse: NSObject, Mappable {
    var user: User!
    var token: String!
    
    required init?(map: Map) {
        if map.JSON["user"] == nil { return nil }
        if map.JSON["token"] == nil { return nil }
    }
    
    func mapping(map: Map) {
        user    <- map["user"]
        token   <- map["token"]
    }
}
